<template>
  <div>
     <tables  ref="table" :loadDataApi="getExamineCar"  :tableCofig="tableConfig"  :columns="columns" />
  </div>
  
</template>

<script>
import Tables from '_c/tables'
import { getExamineCar,doExamineCar} from '@/api/car/carApi'
export default {
  components: {
    Tables
  },
  data () {
    return {
        getExamineCar:getExamineCar,
        doExamineCar:doExamineCar,
        tableConfig:{
            idKey:'typeId',
            border:true,
            stripe:true,
            editable:true,
            dataAPi:'',
            editApi:'',
            delApi:'',
            addApi:'',
            buttons:["filtr",'hidel'],
            noDataText:'暂无区域信息',
            action:{
                title:"操作",
                showDel:false,
                showEdit:false,
               
                width:200,
                    buttons:[
                    {title:'通过',type: 'success',action:(params=>{
                            this.examineCar(params.row.id,1);
                    })},
                    {title:'驳回',type: 'error',action:(params=>{
                           this.examineCar(params.row.id,2);
                    })}
                ]
                
            }
        },
       columns: [
            {title: '车辆编号', key: 'id',fixed:'left'},
            {title: '车辆品牌', key: 'brandName',width:100,align:'center'},
            {title: '车辆类型', key: 'model',width:100,align:'center'},
            {title: '车牌号', key: 'plateNumber',tooltip:true,ellipsis:true,width:100,align:'center' },
            {title: '温度', key: 'temperature',width:80,align:'center' },
            {title: '设备号', key: 'driverid' },
            {title: '车辆状态', key: 'use',width:100,align:'center'},
            {title: '承运商', key: 'cid',width:100,align:'center'},
            {title: '注册时间', key: 'createtime'} 
      ]
    }
  },
  methods: {
    examineCar(id,status){
        this.$Message.loading({
                    content: '正在操作中请稍等',
                    duration: 0
        });
        this.doExamineCar(id,status)
        .then(res=>{
            this.$Message.destroy()
            this.$Message.success("操作成功");
            this.$refs.table.loadData()
        })
        .catch(err=>{
            this.$Message.destroy()
            this.$Message.error("操作失败");
        })
    }
  },  
  mounted () {
   
  }
}
</script>

<style>

</style>

